package com.arpa.wms.domain.entity;

import com.alibaba.fastjson.annotation.JSONField;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import org.hibernate.validator.constraints.Length;
import org.springframework.format.annotation.DateTimeFormat;

import javax.validation.constraints.Digits;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
import java.math.BigDecimal;
import java.time.LocalDateTime;
import java.util.List;

/**
 * <p>
 * 承运商
 * </p>
 *
 * @author LEO
 * @since 2021-02-24
 */
@Data
@EqualsAndHashCode(callSuper = true)
@Accessors(chain = true)
@TableName("wms_carrier")
@ApiModel(value="carrier对象", description="承运商")
public class Carrier extends BasicEntity {

    private static final long serialVersionUID = 1L;

    @ApiModelProperty(value = "全局code")
    @TableField("code")
    @NotBlank(message = "code不能为空", groups = {Carrier.Update.class})
    private String code;

    @ApiModelProperty(value = "所属机构")
    @TableField("group_code")
    private String groupCode;

    @ApiModelProperty(value = "承运商编码")
    @TableField("carrier_code")
    // @NotEmpty(message="承运商编码不能为空", groups = {Carrier.Express.class})
    @Length(max = 100, message = "承运商编码长度不能大于100个字符", groups = {Carrier.Save.class})
    private String carrierCode;

    @NotEmpty(message="承运商名称不能为空", groups = {Carrier.Express.class})
    @Length(max = 50, message = "承运商名称长度不能大于50个字符", groups = {Carrier.Express.class,Carrier.Save.class})
    @ApiModelProperty(value = "承运商名称")
    @TableField("name")
    private String name;


    @ApiModelProperty(value = "联系人")
    @NotEmpty(message="联系人不能为空", groups = {Carrier.Logistics.class})
    @Length(max = 50, message = "联系人长度不能大于50个字符", groups = {Carrier.Save.class, Carrier.Update.class})
    @TableField("contacts")
    private String contacts;

    @ApiModelProperty(value = "手机号")
    @NotEmpty(message="手机号不能为空", groups = {Carrier.Logistics.class})
    @Length(max = 18, message = "手机号长度不能大于18个字符", groups = {Carrier.Save.class, Carrier.Update.class})
    @TableField("phone")
    private String phone;

    @ApiModelProperty(value = "信用代码")
    @TableField("business_license_number")
    @Length(max = 50, message = "信用代码长度不能大于50个字符", groups = {Carrier.Save.class, Carrier.Update.class})
    private String businessLicenseImgNumber;

    @ApiModelProperty(value = "税点")
    @TableField("tax_point")
    @Digits(integer = 20, fraction = 6,message = "税点错误", groups = {Carrier.Save.class, Carrier.Update.class})
    private BigDecimal taxPoint;

    @ApiModelProperty(value = "法人")
    @TableField("legal_person")
    @Length(max = 50, message = "法人姓名长度不能大于50个字符", groups = {Carrier.Save.class, Carrier.Update.class})
    private String legalPerson;

    @ApiModelProperty(value = "身份证号")
    @TableField("id_card")
    private String idCard;


    @ApiModelProperty(value = "国家")
    @TableField("country")
    private String country;

    @ApiModelProperty(value = "省")
    @TableField("province")
    private String province;

    @ApiModelProperty(value = "市")
    @TableField("city")
    private String city;

    @ApiModelProperty(value = "县/区")
    @TableField("county")
    @Length(max = 50, message = "所在区域不能大于50个字符", groups = {Carrier.Save.class, Carrier.Update.class})
    private String county;

    @ApiModelProperty(value = "地址")
    @TableField("address")
    @Length(max = 200, message = "详细地址不能大于200个字符", groups = {Carrier.Save.class, Carrier.Update.class})
    private String address;

    @ApiModelProperty(value = "备注")
    @TableField("remark")
    @Length(max = 200, message = "备注不能大于200个字符", groups = {Carrier.Save.class, Carrier.Update.class})
    private String remark;

    @ApiModelProperty(value = "是否结算：0不结算，1结算")
    @TableField("is_settlement")
    @NotNull(message="请选择是否结算", groups = {Carrier.Logistics.class})
    private Integer isSettlement;

    @ApiModelProperty(value = "审批人编码")
    @TableField("approved_by")
    private String approvedBy;

    @ApiModelProperty(value = "审批人姓名")
    @TableField("approved_name")
    @Length(max = 50, message = "姓名长度不能大于50个字符", groups = {Carrier.Save.class, Carrier.Update.class})
    private String approvedName;

    @ApiModelProperty(value = "审批时间")
    @TableField("gmt_approved")
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @JSONField(format = "yyyy-MM-dd HH:mm:ss")
    private LocalDateTime gmtApproved;


    @ApiModelProperty(value = "入驻商名称")
    @TableField("shipment_name")
    @NotEmpty(message="入驻商名称不能为空", groups = {Carrier.Save.class})
    @Length(max = 64, message = "入驻商名称不能大于64个字符", groups = {Carrier.Save.class, Carrier.Update.class})
    private String shipmentName;

    @ApiModelProperty(value = "入驻商编码")
    @TableField("shipment_code")
    @NotEmpty(message="入驻商编码不能为空", groups = {Carrier.Save.class})
    @Length(max = 32, message = "入驻商编码不能大于32个字符", groups = {Carrier.Save.class, Carrier.Update.class})
    private String shipmentCode;

    @ApiModelProperty(value = "承运商类型")
    @TableField("carrier_type")
    @NotEmpty(message="承运商类型不能为空", groups = {Carrier.Save.class})
    @Length(max = 32, message = "承运商类型不能大于32个字符", groups = {Carrier.Save.class, Carrier.Update.class})
    private String carrierType;

    @ApiModelProperty(value = "key")
    @TableField("qimen_key")
    @Length(max = 500, message = "key不能大于500个字符", groups = {Carrier.Save.class, Carrier.Update.class})
    private String qimenKey;

    @ApiModelProperty(value = "电子面单密码")
    @TableField("waybill_password")
    @Length(max = 500, message = "电子面单密码不能大于500个字符", groups = {Carrier.Save.class, Carrier.Update.class})
    private String waybillPassword;

    @ApiModelProperty(value = "外部编码")
    @TableField("outer_code")
    @Length(max = 500, message = "外部编码不能大于500个字符", groups = {Carrier.Save.class, Carrier.Update.class})
    private String outerCode;

    @ApiModelProperty(value = "仓库编码")
    @TableField("warehouse_code")
    @Length(max = 100, message = "仓库编码不能大于100个字符", groups = {Carrier.Save.class, Carrier.Update.class})
    private String warehouseCode;

    @ApiModelProperty(value = "仓库名称")
    @TableField("warehouse_name")
    @Length(max = 100, message = "仓库名称不能大于100个字符", groups = {Carrier.Save.class, Carrier.Update.class})
    private String warehouseName;

    @ApiModelProperty(value = "模板类型")
    @TableField("template_type")
    @Length(max = 100, message = "模板类型不能大于100个字符", groups = {Carrier.Save.class, Carrier.Update.class})
    private String templateType;

    @ApiModelProperty(value = "模板名称")
    @TableField("template_name")
    @Length(max = 100, message = "模板名称不能大于100个字符", groups = {Carrier.Save.class, Carrier.Update.class})
    private String templateName;

    @ApiModelProperty(value = "模板地址")
    @TableField("template_address")
    @Length(max = 500, message = "模板地址不能大于500个字符", groups = {Carrier.Save.class, Carrier.Update.class})
    private String templateAddress;

    @ApiModelProperty(value = "模板编码")
    @TableField("template_code")
    @Length(max = 100, message = "模板编码不能大于100个字符", groups = {Carrier.Save.class, Carrier.Update.class})
    private String templateCode;

    @ApiModelProperty(value = "店铺编码")
    @TableField("shop_code")
    @Length(max = 100, message = "店铺编码不能大于100个字符", groups = {Carrier.Save.class, Carrier.Update.class})
    private String shopCode;

    @ApiModelProperty(value = "店铺名称")
    @TableField("shop_name")
    @Length(max = 100, message = "店铺名称不能大于100个字符", groups = {Carrier.Save.class, Carrier.Update.class})
    private String shopName;

    /**
     * 发件人名称
     */
    @ApiModelProperty(value = "发件人名称")
    @TableField("sender_name")
    private String senderName;

    /**
     * 发件人移动电话
     */
    @ApiModelProperty(value = "发件人移动电话")
    @TableField("sender_mobile")
    private String senderMobile;


    @ApiModelProperty(value = "发货地址")
    @TableField("send_address")
    @Length(max = 100, message = "发货地址不能大于500个字符", groups = {Carrier.Express.class})
    private String sendAddress;


    /**
     * 状态：0未审核，1：审核通过，2：审核未通过
     */
    @ApiModelProperty(value = "状态")
    @TableField("status")
    private String status;

    @ApiModelProperty(value = "区域信息")
    @TableField(exist = false)
    private List<String> areaList;

    @ApiModelProperty(value = "区域信息")
    @TableField(exist = false)
    private String area;

    @ApiModelProperty(value = "发件人省份")
    @TableField("sender_province")
    private String senderProvince;

    @ApiModelProperty(value = "发件人城市")
    @TableField("sender_city")
    private String senderCity;

    @ApiModelProperty(value = "发件人市区")
    @TableField("sender_district")
    private String senderDistrict;

    @ApiModelProperty(value = "标准模板类型")
    @TableField("standardWaybillType")
    private Integer standardWaybillType;

    @ApiModelProperty(value = "标准模板URL")
    @TableField("standardTemplateUrl")
    private String standardTemplateUrl;

    @ApiModelProperty(value = "标准模板名称")
    @TableField("standardTemplateName")
    private String standardTemplateName;

    @ApiModelProperty(value = "平台类型：CAINIAO:菜鸟；JD:京东；PDD:拼多多；DY:抖音；")
    @TableField("platform_type")
    private String platformType;

    @ApiModelProperty(value = "承运商ID")
    @TableField("provider_id")
    private Integer providerId;

    @ApiModelProperty(value = "商家编码")
    @TableField("vendor_code")
    private String vendorCode;

    @ApiModelProperty(value = "商家名称")
    @TableField("vendor_name")
    private String vendorName;

    @ApiModelProperty(value = "承运商发货网点编码")
    @TableField("branch_code")
    private String branchCode;

    @ApiModelProperty(value = "承运商发货网点名称")
    @TableField("branch_name")
    private String branchName;

    @ApiModelProperty(value = "顺丰快递产品编码，仅适用于淘宝顺分")
    @TableField("product_code")
    private String productCode;

    @ApiModelProperty(value = "顺丰快递品牌编码，仅适用于淘宝顺丰")
    @TableField("brand_code")
    private String brandCode;

    @ApiModelProperty(value = "月结卡号")
    @TableField("customer_code")
    private String customerCode;

    @ApiModelProperty(value = "快件产品类别，目前顺丰使用，后续可根据承运商自己定义 。1-顺丰标快；2-顺丰特惠")
    @TableField("express_type")
    private String expressType;

    @ApiModelProperty(value = "快递费付款方式(顺丰必填)，1:寄方付 2:收方付 3:第三方付")
    @TableField("express_pay_method")
    private String expressPayMethod;

    //快手的直营物流的官方文档：https://docs.qingque.cn/d/home/eZQCstmJ4XYNo4WQdS1sPlw9E?identityId=1hu1ksD6aDT#
    //    @ApiModelProperty(value = "快手面单扩展信息")
    @TableField("ext_data")
    private String extData;

    //    @ApiModelProperty(value = "物流产品，默认 "ed-m-0001" 特惠送")
    @TableField("express_product_code ")
    private String  expressProductCode;





    public interface Save {

    }

    public interface Update {

    }
    public interface Express {

    }
    public interface Logistics {

    }
}
